\(\int \frac {\tan ^3(e+f x)}{(a+b \tan ^2(e+f x))^3} \, dx\) [238]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 97 \[ \int \frac {\tan ^3(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx=\frac {\log \left (a \cos ^2(e+f x)+b \sin ^2(e+f x)\right )}{2 (a-b)^3 f}-\frac {a}{4 (a-b) b f \left (a+b \tan ^2(e+f x)\right )^2}-\frac {1}{2 (a-b)^2 f \left (a+b \tan ^2(e+f x)\right )} \]

[Out]

1/2*ln(a*cos(f*x+e)^2+b*sin(f*x+e)^2)/(a-b)^3/f-1/4*a/(a-b)/b/f/(a+b*tan(f*x+e)^2)^2-1/2/(a-b)^2/f/(a+b*tan(f*
x+e)^2)

Rubi [A] (verified)

Time = 0.14 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3751, 457, 78} \[ \int \frac {\tan ^3(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx=-\frac {a}{4 b f (a-b) \left (a+b \tan ^2(e+f x)\right )^2}-\frac {1}{2 f (a-b)^2 \left (a+b \tan ^2(e+f x)\right )}+\frac {\log \left (a \cos ^2(e+f x)+b \sin ^2(e+f x)\right )}{2 f (a-b)^3} \]

[In]

Int[Tan[e + f*x]^3/(a + b*Tan[e + f*x]^2)^3,x]

[Out]

Log[a*Cos[e + f*x]^2 + b*Sin[e + f*x]^2]/(2*(a - b)^3*f) - a/(4*(a - b)*b*f*(a + b*Tan[e + f*x]^2)^2) - 1/(2*(
a - b)^2*f*(a + b*Tan[e + f*x]^2))

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 457

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {x^3}{\left (1+x^2\right ) \left (a+b x^2\right )^3} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\text {Subst}\left (\int \frac {x}{(1+x) (a+b x)^3} \, dx,x,\tan ^2(e+f x)\right )}{2 f} \\ & = \frac {\text {Subst}\left (\int \left (-\frac {1}{(a-b)^3 (1+x)}+\frac {a}{(a-b) (a+b x)^3}+\frac {b}{(a-b)^2 (a+b x)^2}+\frac {b}{(a-b)^3 (a+b x)}\right ) \, dx,x,\tan ^2(e+f x)\right )}{2 f} \\ & = \frac {\log \left (a \cos ^2(e+f x)+b \sin ^2(e+f x)\right )}{2 (a-b)^3 f}-\frac {a}{4 (a-b) b f \left (a+b \tan ^2(e+f x)\right )^2}-\frac {1}{2 (a-b)^2 f \left (a+b \tan ^2(e+f x)\right )} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.80 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.90 \[ \int \frac {\tan ^3(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx=\frac {4 \log (\cos (e+f x))+2 \log \left (a+b \tan ^2(e+f x)\right )-\frac {a (a-b)^2}{b \left (a+b \tan ^2(e+f x)\right )^2}-\frac {2 (a-b)}{a+b \tan ^2(e+f x)}}{4 (a-b)^3 f} \]

[In]

Integrate[Tan[e + f*x]^3/(a + b*Tan[e + f*x]^2)^3,x]

[Out]

(4*Log[Cos[e + f*x]] + 2*Log[a + b*Tan[e + f*x]^2] - (a*(a - b)^2)/(b*(a + b*Tan[e + f*x]^2)^2) - (2*(a - b))/
(a + b*Tan[e + f*x]^2))/(4*(a - b)^3*f)

Maple [A] (verified)

Time = 0.13 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.04

method result size
derivativedivides \(\frac {\frac {-\frac {a \left (a^{2}-2 a b +b^{2}\right )}{2 b \left (a +b \tan \left (f x +e \right )^{2}\right )^{2}}+\ln \left (a +b \tan \left (f x +e \right )^{2}\right )-\frac {a -b}{a +b \tan \left (f x +e \right )^{2}}}{2 \left (a -b \right )^{3}}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 \left (a -b \right )^{3}}}{f}\) \(101\)
default \(\frac {\frac {-\frac {a \left (a^{2}-2 a b +b^{2}\right )}{2 b \left (a +b \tan \left (f x +e \right )^{2}\right )^{2}}+\ln \left (a +b \tan \left (f x +e \right )^{2}\right )-\frac {a -b}{a +b \tan \left (f x +e \right )^{2}}}{2 \left (a -b \right )^{3}}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 \left (a -b \right )^{3}}}{f}\) \(101\)
norman \(\frac {-\frac {b \tan \left (f x +e \right )^{2}}{2 \left (a^{2}-2 a b +b^{2}\right ) f}+\frac {\left (-a b -b^{2}\right ) a}{4 b^{2} \left (a^{2}-2 a b +b^{2}\right ) f}}{\left (a +b \tan \left (f x +e \right )^{2}\right )^{2}}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \left (a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}\right )}+\frac {\ln \left (a +b \tan \left (f x +e \right )^{2}\right )}{2 f \left (a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}\right )}\) \(157\)
parallelrisch \(-\frac {2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right )^{4} b^{4}-2 \ln \left (a +b \tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right )^{4} b^{4}+4 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right )^{2} a \,b^{3}-4 \ln \left (a +b \tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right )^{2} a \,b^{3}+2 \tan \left (f x +e \right )^{2} a \,b^{3}-2 b^{4} \tan \left (f x +e \right )^{2}+2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} b^{2}-2 \ln \left (a +b \tan \left (f x +e \right )^{2}\right ) a^{2} b^{2}+a^{3} b -a \,b^{3}}{4 \left (a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}\right ) \left (a +b \tan \left (f x +e \right )^{2}\right )^{2} b^{2} f}\) \(227\)
risch \(-\frac {i x}{a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}}-\frac {2 i e}{f \left (a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}\right )}+\frac {2 a^{2} {\mathrm e}^{6 i \left (f x +e \right )}-2 b^{2} {\mathrm e}^{6 i \left (f x +e \right )}+4 a^{2} {\mathrm e}^{4 i \left (f x +e \right )}+4 a b \,{\mathrm e}^{4 i \left (f x +e \right )}+4 b^{2} {\mathrm e}^{4 i \left (f x +e \right )}+2 a^{2} {\mathrm e}^{2 i \left (f x +e \right )}-2 b^{2} {\mathrm e}^{2 i \left (f x +e \right )}}{\left (a \,{\mathrm e}^{4 i \left (f x +e \right )}-b \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+2 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a -b \right )^{2} f \left (a^{2}-2 a b +b^{2}\right ) \left (a -b \right )}+\frac {\ln \left ({\mathrm e}^{4 i \left (f x +e \right )}+\frac {2 \left (a +b \right ) {\mathrm e}^{2 i \left (f x +e \right )}}{a -b}+1\right )}{2 f \left (a^{3}-3 a^{2} b +3 a \,b^{2}-b^{3}\right )}\) \(295\)

[In]

int(tan(f*x+e)^3/(a+b*tan(f*x+e)^2)^3,x,method=_RETURNVERBOSE)

[Out]

1/f*(1/2/(a-b)^3*(-1/2*a*(a^2-2*a*b+b^2)/b/(a+b*tan(f*x+e)^2)^2+ln(a+b*tan(f*x+e)^2)-(a-b)/(a+b*tan(f*x+e)^2))
-1/2/(a-b)^3*ln(1+tan(f*x+e)^2))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 212 vs. \(2 (91) = 182\).

Time = 0.28 (sec) , antiderivative size = 212, normalized size of antiderivative = 2.19 \[ \int \frac {\tan ^3(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx=\frac {{\left (a b + 2 \, b^{2}\right )} \tan \left (f x + e\right )^{4} + 2 \, {\left (a^{2} + a b + b^{2}\right )} \tan \left (f x + e\right )^{2} + 2 \, a^{2} + a b + 2 \, {\left (b^{2} \tan \left (f x + e\right )^{4} + 2 \, a b \tan \left (f x + e\right )^{2} + a^{2}\right )} \log \left (\frac {b \tan \left (f x + e\right )^{2} + a}{\tan \left (f x + e\right )^{2} + 1}\right )}{4 \, {\left ({\left (a^{3} b^{2} - 3 \, a^{2} b^{3} + 3 \, a b^{4} - b^{5}\right )} f \tan \left (f x + e\right )^{4} + 2 \, {\left (a^{4} b - 3 \, a^{3} b^{2} + 3 \, a^{2} b^{3} - a b^{4}\right )} f \tan \left (f x + e\right )^{2} + {\left (a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3}\right )} f\right )}} \]

[In]

integrate(tan(f*x+e)^3/(a+b*tan(f*x+e)^2)^3,x, algorithm="fricas")

[Out]

1/4*((a*b + 2*b^2)*tan(f*x + e)^4 + 2*(a^2 + a*b + b^2)*tan(f*x + e)^2 + 2*a^2 + a*b + 2*(b^2*tan(f*x + e)^4 +
 2*a*b*tan(f*x + e)^2 + a^2)*log((b*tan(f*x + e)^2 + a)/(tan(f*x + e)^2 + 1)))/((a^3*b^2 - 3*a^2*b^3 + 3*a*b^4
 - b^5)*f*tan(f*x + e)^4 + 2*(a^4*b - 3*a^3*b^2 + 3*a^2*b^3 - a*b^4)*f*tan(f*x + e)^2 + (a^5 - 3*a^4*b + 3*a^3
*b^2 - a^2*b^3)*f)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 2819 vs. \(2 (75) = 150\).

Time = 69.83 (sec) , antiderivative size = 2819, normalized size of antiderivative = 29.06 \[ \int \frac {\tan ^3(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx=\text {Too large to display} \]

[In]

integrate(tan(f*x+e)**3/(a+b*tan(f*x+e)**2)**3,x)

[Out]

Piecewise((zoo*x/tan(e)**3, Eq(a, 0) & Eq(b, 0) & Eq(f, 0)), ((-log(tan(e + f*x)**2 + 1)/(2*f) + tan(e + f*x)*
*2/(2*f))/a**3, Eq(b, 0)), (-3*tan(e + f*x)**2/(12*b**3*f*tan(e + f*x)**6 + 36*b**3*f*tan(e + f*x)**4 + 36*b**
3*f*tan(e + f*x)**2 + 12*b**3*f) - 1/(12*b**3*f*tan(e + f*x)**6 + 36*b**3*f*tan(e + f*x)**4 + 36*b**3*f*tan(e
+ f*x)**2 + 12*b**3*f), Eq(a, b)), (x*tan(e)**3/(a + b*tan(e)**2)**3, Eq(f, 0)), (-a**3/(4*a**5*b*f + 8*a**4*b
**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f + 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a
**3*b**3*f - 12*a**2*b**4*f*tan(e + f*x)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan
(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)**2 - 4*b**6*f*tan(e + f*x)**4) + 2*a**2*b*log(-sqrt(-a/b) + tan(e + f*x
))/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f + 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3
*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*x)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2
*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)**2 - 4*b**6*f*tan(e + f*x)**4) + 2*a**2*b*log(
sqrt(-a/b) + tan(e + f*x))/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f + 4*a**3*b**3*f*tan(e
+ f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*x)**4 + 24*a**2*b**4*f*
tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)**2 - 4*b**6*f*tan(e +
f*x)**4) - 2*a**2*b*log(tan(e + f*x)**2 + 1)/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f + 4*
a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*x)**4
 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)**2 -
 4*b**6*f*tan(e + f*x)**4) + 4*a*b**2*log(-sqrt(-a/b) + tan(e + f*x))*tan(e + f*x)**2/(4*a**5*b*f + 8*a**4*b**
2*f*tan(e + f*x)**2 - 12*a**4*b**2*f + 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**
3*b**3*f - 12*a**2*b**4*f*tan(e + f*x)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e
 + f*x)**4 - 8*a*b**5*f*tan(e + f*x)**2 - 4*b**6*f*tan(e + f*x)**4) + 4*a*b**2*log(sqrt(-a/b) + tan(e + f*x))*
tan(e + f*x)**2/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f + 4*a**3*b**3*f*tan(e + f*x)**4 -
 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*x)**4 + 24*a**2*b**4*f*tan(e + f*x
)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)**2 - 4*b**6*f*tan(e + f*x)**4) -
4*a*b**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**2/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f
 + 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*
x)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)
**2 - 4*b**6*f*tan(e + f*x)**4) - 2*a*b**2*tan(e + f*x)**2/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a*
*4*b**2*f + 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*t
an(e + f*x)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan
(e + f*x)**2 - 4*b**6*f*tan(e + f*x)**4) + a*b**2/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f
 + 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*
x)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)
**2 - 4*b**6*f*tan(e + f*x)**4) + 2*b**3*log(-sqrt(-a/b) + tan(e + f*x))*tan(e + f*x)**4/(4*a**5*b*f + 8*a**4*
b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f + 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*
a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*x)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*ta
n(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)**2 - 4*b**6*f*tan(e + f*x)**4) + 2*b**3*log(sqrt(-a/b) + tan(e + f*x))
*tan(e + f*x)**4/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f + 4*a**3*b**3*f*tan(e + f*x)**4
- 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*x)**4 + 24*a**2*b**4*f*tan(e + f*
x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)**2 - 4*b**6*f*tan(e + f*x)**4) -
 2*b**3*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**4/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*b**2*f
+ 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(e + f*x
)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e + f*x)*
*2 - 4*b**6*f*tan(e + f*x)**4) + 2*b**3*tan(e + f*x)**2/(4*a**5*b*f + 8*a**4*b**2*f*tan(e + f*x)**2 - 12*a**4*
b**2*f + 4*a**3*b**3*f*tan(e + f*x)**4 - 24*a**3*b**3*f*tan(e + f*x)**2 + 12*a**3*b**3*f - 12*a**2*b**4*f*tan(
e + f*x)**4 + 24*a**2*b**4*f*tan(e + f*x)**2 - 4*a**2*b**4*f + 12*a*b**5*f*tan(e + f*x)**4 - 8*a*b**5*f*tan(e
+ f*x)**2 - 4*b**6*f*tan(e + f*x)**4), True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 194 vs. \(2 (91) = 182\).

Time = 0.23 (sec) , antiderivative size = 194, normalized size of antiderivative = 2.00 \[ \int \frac {\tan ^3(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx=-\frac {\frac {2 \, {\left (a^{2} - b^{2}\right )} \sin \left (f x + e\right )^{2} - 2 \, a^{2} - a b}{a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3} + {\left (a^{5} - 5 \, a^{4} b + 10 \, a^{3} b^{2} - 10 \, a^{2} b^{3} + 5 \, a b^{4} - b^{5}\right )} \sin \left (f x + e\right )^{4} - 2 \, {\left (a^{5} - 4 \, a^{4} b + 6 \, a^{3} b^{2} - 4 \, a^{2} b^{3} + a b^{4}\right )} \sin \left (f x + e\right )^{2}} - \frac {2 \, \log \left (-{\left (a - b\right )} \sin \left (f x + e\right )^{2} + a\right )}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}}}{4 \, f} \]

[In]

integrate(tan(f*x+e)^3/(a+b*tan(f*x+e)^2)^3,x, algorithm="maxima")

[Out]

-1/4*((2*(a^2 - b^2)*sin(f*x + e)^2 - 2*a^2 - a*b)/(a^5 - 3*a^4*b + 3*a^3*b^2 - a^2*b^3 + (a^5 - 5*a^4*b + 10*
a^3*b^2 - 10*a^2*b^3 + 5*a*b^4 - b^5)*sin(f*x + e)^4 - 2*(a^5 - 4*a^4*b + 6*a^3*b^2 - 4*a^2*b^3 + a*b^4)*sin(f
*x + e)^2) - 2*log(-(a - b)*sin(f*x + e)^2 + a)/(a^3 - 3*a^2*b + 3*a*b^2 - b^3))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 474 vs. \(2 (91) = 182\).

Time = 1.15 (sec) , antiderivative size = 474, normalized size of antiderivative = 4.89 \[ \int \frac {\tan ^3(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx=\frac {\frac {2 \, \log \left (a + \frac {2 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {4 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}} - \frac {4 \, \log \left ({\left | -\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1 \right |}\right )}{a^{3} - 3 \, a^{2} b + 3 \, a b^{2} - b^{3}} - \frac {3 \, a^{3} + \frac {20 \, a^{3} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {32 \, a^{2} b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {34 \, a^{3} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} - \frac {80 \, a^{2} b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {48 \, a b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {16 \, b^{3} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {20 \, a^{3} {\left (\cos \left (f x + e\right ) - 1\right )}^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}} - \frac {32 \, a^{2} b {\left (\cos \left (f x + e\right ) - 1\right )}^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}} + \frac {3 \, a^{3} {\left (\cos \left (f x + e\right ) - 1\right )}^{4}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{4}}}{{\left (a^{4} - 3 \, a^{3} b + 3 \, a^{2} b^{2} - a b^{3}\right )} {\left (a + \frac {2 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {4 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}^{2}}}{4 \, f} \]

[In]

integrate(tan(f*x+e)^3/(a+b*tan(f*x+e)^2)^3,x, algorithm="giac")

[Out]

1/4*(2*log(a + 2*a*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 4*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + a*(cos(
f*x + e) - 1)^2/(cos(f*x + e) + 1)^2)/(a^3 - 3*a^2*b + 3*a*b^2 - b^3) - 4*log(abs(-(cos(f*x + e) - 1)/(cos(f*x
 + e) + 1) + 1))/(a^3 - 3*a^2*b + 3*a*b^2 - b^3) - (3*a^3 + 20*a^3*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 32*
a^2*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 34*a^3*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2 - 80*a^2*b*(cos
(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2 + 48*a*b^2*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2 + 16*b^3*(cos(f*x +
 e) - 1)^2/(cos(f*x + e) + 1)^2 + 20*a^3*(cos(f*x + e) - 1)^3/(cos(f*x + e) + 1)^3 - 32*a^2*b*(cos(f*x + e) -
1)^3/(cos(f*x + e) + 1)^3 + 3*a^3*(cos(f*x + e) - 1)^4/(cos(f*x + e) + 1)^4)/((a^4 - 3*a^3*b + 3*a^2*b^2 - a*b
^3)*(a + 2*a*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 4*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + a*(cos(f*x +
e) - 1)^2/(cos(f*x + e) + 1)^2)^2))/f

Mupad [B] (verification not implemented)

Time = 11.59 (sec) , antiderivative size = 532, normalized size of antiderivative = 5.48 \[ \int \frac {\tan ^3(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx=\frac {\frac {a^3\,{\cos \left (e+f\,x\right )}^4}{4}-\frac {a\,b^2\,{\cos \left (e+f\,x\right )}^4}{4}+b^3\,{\sin \left (e+f\,x\right )}^4\,\mathrm {atan}\left (\frac {a\,{\sin \left (e+f\,x\right )}^2-b\,{\sin \left (e+f\,x\right )}^2}{a\,{\cos \left (e+f\,x\right )}^2\,2{}\mathrm {i}+a\,{\sin \left (e+f\,x\right )}^2\,1{}\mathrm {i}+b\,{\sin \left (e+f\,x\right )}^2\,1{}\mathrm {i}}\right )\,1{}\mathrm {i}-\frac {b^3\,{\cos \left (e+f\,x\right )}^2\,{\sin \left (e+f\,x\right )}^2}{2}+a^2\,b\,{\cos \left (e+f\,x\right )}^4\,\mathrm {atan}\left (\frac {a\,{\sin \left (e+f\,x\right )}^2-b\,{\sin \left (e+f\,x\right )}^2}{a\,{\cos \left (e+f\,x\right )}^2\,2{}\mathrm {i}+a\,{\sin \left (e+f\,x\right )}^2\,1{}\mathrm {i}+b\,{\sin \left (e+f\,x\right )}^2\,1{}\mathrm {i}}\right )\,1{}\mathrm {i}+\frac {a\,b^2\,{\cos \left (e+f\,x\right )}^2\,{\sin \left (e+f\,x\right )}^2}{2}+a\,b^2\,{\cos \left (e+f\,x\right )}^2\,{\sin \left (e+f\,x\right )}^2\,\mathrm {atan}\left (\frac {a\,{\sin \left (e+f\,x\right )}^2-b\,{\sin \left (e+f\,x\right )}^2}{a\,{\cos \left (e+f\,x\right )}^2\,2{}\mathrm {i}+a\,{\sin \left (e+f\,x\right )}^2\,1{}\mathrm {i}+b\,{\sin \left (e+f\,x\right )}^2\,1{}\mathrm {i}}\right )\,2{}\mathrm {i}}{f\,\left (-a^5\,b\,{\cos \left (e+f\,x\right )}^4+3\,a^4\,b^2\,{\cos \left (e+f\,x\right )}^4-2\,a^4\,b^2\,{\cos \left (e+f\,x\right )}^2\,{\sin \left (e+f\,x\right )}^2-3\,a^3\,b^3\,{\cos \left (e+f\,x\right )}^4+6\,a^3\,b^3\,{\cos \left (e+f\,x\right )}^2\,{\sin \left (e+f\,x\right )}^2-a^3\,b^3\,{\sin \left (e+f\,x\right )}^4+a^2\,b^4\,{\cos \left (e+f\,x\right )}^4-6\,a^2\,b^4\,{\cos \left (e+f\,x\right )}^2\,{\sin \left (e+f\,x\right )}^2+3\,a^2\,b^4\,{\sin \left (e+f\,x\right )}^4+2\,a\,b^5\,{\cos \left (e+f\,x\right )}^2\,{\sin \left (e+f\,x\right )}^2-3\,a\,b^5\,{\sin \left (e+f\,x\right )}^4+b^6\,{\sin \left (e+f\,x\right )}^4\right )} \]

[In]

int(tan(e + f*x)^3/(a + b*tan(e + f*x)^2)^3,x)

[Out]

((a^3*cos(e + f*x)^4)/4 - (a*b^2*cos(e + f*x)^4)/4 + b^3*sin(e + f*x)^4*atan((a*sin(e + f*x)^2 - b*sin(e + f*x
)^2)/(a*cos(e + f*x)^2*2i + a*sin(e + f*x)^2*1i + b*sin(e + f*x)^2*1i))*1i - (b^3*cos(e + f*x)^2*sin(e + f*x)^
2)/2 + a^2*b*cos(e + f*x)^4*atan((a*sin(e + f*x)^2 - b*sin(e + f*x)^2)/(a*cos(e + f*x)^2*2i + a*sin(e + f*x)^2
*1i + b*sin(e + f*x)^2*1i))*1i + (a*b^2*cos(e + f*x)^2*sin(e + f*x)^2)/2 + a*b^2*cos(e + f*x)^2*sin(e + f*x)^2
*atan((a*sin(e + f*x)^2 - b*sin(e + f*x)^2)/(a*cos(e + f*x)^2*2i + a*sin(e + f*x)^2*1i + b*sin(e + f*x)^2*1i))
*2i)/(f*(b^6*sin(e + f*x)^4 - a^5*b*cos(e + f*x)^4 - 3*a*b^5*sin(e + f*x)^4 + a^2*b^4*cos(e + f*x)^4 - 3*a^3*b
^3*cos(e + f*x)^4 + 3*a^4*b^2*cos(e + f*x)^4 + 3*a^2*b^4*sin(e + f*x)^4 - a^3*b^3*sin(e + f*x)^4 + 2*a*b^5*cos
(e + f*x)^2*sin(e + f*x)^2 - 6*a^2*b^4*cos(e + f*x)^2*sin(e + f*x)^2 + 6*a^3*b^3*cos(e + f*x)^2*sin(e + f*x)^2
 - 2*a^4*b^2*cos(e + f*x)^2*sin(e + f*x)^2))